<?php

function slot($name, $content = null)
{
    static $slots = array();

    if (null === $content)
    {
        return (isset($slots[$name])) ? $slots[$name] : false;
    }
    $slots[$name] = $content;
    return $content;
}

function slot_begin($name)
{
    ob_start();
}

function slot_end($name)
{
    $slotContent = ob_get_clean();
    slot($name, $slotContent);
}

function slot_exists($name)
{
    if (!slot($name))
    {
        return false;
    }
    return true;
}